import {useRoutes,Navigate} from 'react-router-dom'
import pages from '@/page/index'
// 定义路由表
const BaseRoute = ()=>{
  const routers = useRoutes([
    {
      path:"/",
      element: <Navigate to="/login" replace={true}></Navigate>
    },
    {
      path:"/login",
      element: <pages.Login />
    },
    {
      path:"/register",
      element: <pages.Register />
    },
    {
      path: "/",
      element: <pages.Layout />,
      children:[
        {
          path: 'home',
          element: <pages.Home />
        },
        {
          path: 'datamanagment',
          element: <pages.DataManagment />
        },
        {
          path: 'logmanagment',
          element: <pages.LogManagment />
        },
        {
          path: 'usermanagment',
          element: <pages.UserManagment />
        },
      ]
    }
  ])
  return routers
}

export default BaseRoute;